<div class="table-responsive">
<div class="filter-bar">
<form action="__CONTROLLER__/index" method="post" >
	<div class="view">
		<div class="row clearfix">
			<div class="col-md-3 column ui-sortable">
			    <label class="col-sm-3 control-label">管理员</label>
			    <div class="col-sm-9">
				      <input type="text" class="form-control" name="name" placeholder="" value="{$params.name}">
			    </div>
			</div>
			<div class="col-md-3 column ui-sortable">
			    <label class="col-sm-2 control-label" style="margin-top:6px;">时间</label>
			    <div class="col-sm-8">
				   <div id="reportrange" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc">
	                  <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
	                  <span></span> <b class="caret"></b>
	                  <input type="hidden" name="startDate" value="{$params.startDate}"/><input type="hidden" name="endDate" value="{$params.endDate}"/>
	               </div>
			    </div>
			</div>
			<div class="col-md-3 column ui-sortable">
			    <div class="col-sm-9">
			       <input type="submit" class="btn btn-info submit" value="搜索"/>
			       <input id="btnExportExcel" data-url="{:U('PartnerLoginLog/exportXLS', $params)}" type="button" class="btn btn-info" value="导出Excel"/>
			    </div>
			</div>
		</div>
	</div>
</form>
 </div>
 <hr/>
<table class="table table-hover">
 <thead>
  <tr>
   <th>ID</th>
   <th>管理员</th>
   <th>IP</th>
   <th>登入时间</th>
   <th>最后活跃时间</th>
   <th>登出时间</th>
  </tr>
 </thead>
 <tbody>
  <volist name="partnerLoginLogList" id="vo">
   <tr>
    <td>{$vo.id}</td>
    <td>{$vo.adminName}</td>
    <td>{$vo.ip}</td>
    <td>{$vo.create_time|date='Y-m-d h:i:s',###}</td>
    <td>{$vo.last_activity_time|date='Y-m-d h:i:s',###}</td>
    <td>{$vo[loginout_time]?date('Y-m-d h:i:s',$vo[loginout_time]):'--'}</td>
   </tr>
  </volist>
 </tbody>
</table>
<div class="pagination">{$pagination}</div>
</div>
<!-- daterangepicker -->
<link rel="stylesheet" type="text/css" media="all" href="__PUBLIC__/Style/Common/daterangepicker/daterangepicker-bs3.css" />
<script type="text/javascript" src="__PUBLIC__/Style/Common/daterangepicker/moment.js"></script>
<script type="text/javascript" src="__PUBLIC__/Style/Common/daterangepicker/daterangepicker.js"></script>
<script type="text/javascript">
$(document).ready(function() {

   var cb = function(start, end, label) {
        console.log(start.toISOString(), end.toISOString(), label);
        $('#reportrange span').html(start.format('YYYY/MM/DD') + ' - ' + end.format('YYYY/MM/DD'));
        $("input[name='startDate']").val(start.valueOf()/1000);
        $("input[name='endDate']").val(Math.floor(end.valueOf()/1000));
        //alert("Callback has fired: [" + start.format('MMMM D, YYYY') + " to " + end.format('MMMM D, YYYY') + ", label = " + label + "]");
   }
   
   var optionSet1 = {
            startDate: moment.unix($("input[name='startDate']").val()),
            endDate: moment.unix($("input[name='endDate']").val()),
            //minDate: '01/01/2012',
            //maxDate: '12/31/2014',
            dateLimit: { days: 60 },
            showDropdowns: true,
            showWeekNumbers: true,
            timePicker: false,
            timePickerIncrement: 1,
            timePicker12Hour: true,
            ranges: {
               '今天': [moment(), moment()],
               '昨天': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
               '7天': [moment().subtract(6, 'days'), moment()],
               '30天': [moment().subtract(29, 'days'), moment()],
               '本月': [moment().startOf('month'), moment().endOf('month')],
               '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
            },
            opens: 'left',
            buttonClasses: ['btn btn-default'],
            applyClass: 'btn-small btn-primary',
            cancelClass: 'btn-small',
            format: 'YYYY/MM/DD',
            separator: ' to ',
            locale: {
                applyLabel: '确定',
                cancelLabel: '关闭',
                fromLabel: '从',
                toLabel: '到',
                customRangeLabel: '自定',
                daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
                monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
                firstDay: 1
            }
    };
    $('#reportrange span').html(optionSet1.startDate.format('YYYY/MM/DD') + ' - ' + optionSet1.endDate.format('YYYY/MM/DD'));
    $('#reportrange').daterangepicker(optionSet1, cb);
    
    $("#btnExportExcel").click(function() {
    	window.location.href = $(this).attr('data-url');
    });
});
</script>

